<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .e {
            height: 600px;
            min-width: 1000px;
            font-size: 14px;
        }

    </style>
</head>
<body>

<div>

    <button> ok!!</button>
    <div class="e" id="editor"></div>
    <script src="/asset/js/ace.js" type="text/javascript"
            charset="utf-8"></script>

    <script>
        var editor = ace.edit("editor");
        editor.setTheme("ace/theme/monokai");
        editor.getSession().setMode("ace/mode/yaml");

        editor.container.style.lineHeight = 2
        editor.container.style.fontSize = "14px"
        editor.renderer.updateFontSize()


    </script>


</div>

</body>

<script src="/asset/js/util.js" charset="utf-8"></script>
<script src="/asset/layui/layui.js" charset="utf-8"></script>

<script>
    layui.use(['table', "form"], function () {
        var $ = layui.$


        function ssh_exc() {
            var index = layer.load(1, {
                shade: [0.8, '#585858'] //0.1透明度的白色背景
            });
            $.ajax({
                url: "/salt_ssh/exc?",
                type: "GET",
                success: function (_data) {
                    console.log(_data)
                    editor.setValue(_data)
                    layer.close(index)
                },
                error: function (xhr, type) {
                    layer.msg("请求失败");
                }
            })

        }

        $("body").find("button").on('click', function (event) {
            ssh_exc()
        })

    })

</script>
</html>